﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Master.master" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="MasterPages_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script type="text/javascript">
        window.onload = function () {
            var ulsap = document.getElementsByName("grasp");
            for (i = 0; i < ulsap.length; i++) {

                var radios = ulsap[i].getElementsByTagName('input');
                for (j = 0; j < radios.length; j++) {
                    var radio = radios[j];
                    if (radio.getAttribute("checked") == "checked") {
                        radio.parentNode.parentNode.className = "tagLiSelect";
                    }
                }
            }
            
            var starDivs = document.getElementsByName("star");
            for (i = 0; i < starDivs.length; i++) {
                var value = starDivs[i].getAttribute("star");                
                for (j = 1; j < 6; j++) {                   
                    if (value >= 1){
                        var star1 = document.createElement("img");
                        star1.setAttribute('src', '../Icons/star1.png');
                        star1.setAttribute('class', 'starImg');
                        starDivs[i].appendChild(star1);
                        }
                    else if (value < 1 && value > 0){                        
                        var star2 = document.createElement("img");
                        star2.setAttribute('src', '../Icons/star2.png');
                        star2.setAttribute('class', 'starImg');
                        starDivs[i].appendChild(star2);
                        }
                    else{
                        var star3 = document.createElement("img");
                        star3.setAttribute('src', '../Icons/star3.png');
                        star3.setAttribute('class', 'starImg');
                        starDivs[i].appendChild(star3);
                    }
                    value =value-1;
                }
            }

        }
    </script>
     
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="slideTop" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="navLeft" Runat="Server">
<asp:UpdatePanel runat="server">
    <ContentTemplate>
    <ul class="glibtn1" Name="grasp" >
        <li>     
            
            <asp:RadioButton onchange="renderListUL(this,'tagLiSelect')" ID="checkTop1" 
                runat="server" GroupName="navLeftSelect" Text="Cập nhật" Checked="True" 
                AutoPostBack="True" oncheckedchanged="lvCatalog_SelectedIndexChanged" 
                ToolTip="0" />
        </li>
        <li>
            <asp:RadioButton onchange="renderListUL(this,'tagLiSelect')" ID="checkTop2" 
                runat="server" GroupName="navLeftSelect" Text="Danh sách" AutoPostBack="True" 
                oncheckedchanged="lvCatalog_SelectedIndexChanged" ToolTip="1" />
        </li>
    </ul>
    <asp:MultiView ID="MultiViewLeftNav" runat="server" ActiveViewIndex="1">
        <asp:View ID="View0" runat="server">
            <ul class="verUl">
                <li>
                    <input class="btnLi" type="submit" value="TOP MIỄN PHÍ" name="ctl00$navLeft$ListView3$ctrl0$NameLabel">
                    <asp:ListView ID="ListView4" runat="server" DataSourceID="TopFreeDataSource" 
                        EnableModelValidation="True">                   
                        <EmptyDataTemplate>
                            <span>No data was returned.</span>
                        </EmptyDataTemplate>                
                        <ItemTemplate>
                            <li >  
                                <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Icon") %>' /> 
                                <div >                           
                                    <asp:HyperLink ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />                                                             
                                    <asp:Label ID="CompanyLabel"  runat="server" Text='<%# Eval("Company") %>' />                               
                                </div>  
                            </li>                           
                        </ItemTemplate>
                        <LayoutTemplate>
                            <ul ID="itemPlaceholderContainer" runat="server" class="listSoft">
                                <span runat="server" id="itemPlaceholder" />
                            </ul>
                        </LayoutTemplate>                        
                    </asp:ListView>
                    <asp:ObjectDataSource ID="TopFreeDataSource" runat="server" 
                        SelectMethod="selectTop5" TypeName="UtilObjectData">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="5" Name="top" Type="Int32" />
                            <asp:QueryStringParameter DefaultValue="1" Name="os" QueryStringField="os" 
                                Type="Int32" />
                            <asp:Parameter DefaultValue="1" Name="catalogID" Type="Int32" />
                            <asp:Parameter DefaultValue="0" Name="free" Type="Int32" />
                            <asp:Parameter DefaultValue="true" Name="download1" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="download2" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="topRating" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="topNew" Type="Boolean" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                    <asp:HyperLink ID="btnShowTopFree" class="linkType1" runat="server" 
                        Text="Xem tất cả >>" />
                </li>
                <li>
                    <input class="btnLi" type="submit" value="TOP CÓ PHÍ" >
                    <asp:ListView ID="ListView6" runat="server" DataSourceID="TopDownloadDataSource" EnableModelValidation="True">                
                        <EmptyDataTemplate>
                            <span>No data was returned.</span>
                        </EmptyDataTemplate>                     
                        <ItemTemplate>    
                             <li >  
                                <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Icon") %>' /> 
                                <div >                           
                                    <asp:HyperLink ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />                                                             
                                    <asp:Label ID="CompanyLabel"  runat="server" Text='<%# Eval("Company") %>' />                               
                                </div>  
                            </li>                                            
                        </ItemTemplate>
                        <LayoutTemplate>
                            <ul ID="itemPlaceholderContainer" runat="server" class="listSoft">
                                <span runat="server" id="itemPlaceholder" />
                            </ul>                            
                        </LayoutTemplate>                      
                    </asp:ListView>
                    <asp:ObjectDataSource ID="TopDownloadDataSource" runat="server" 
                        SelectMethod="selectTop5" TypeName="UtilObjectData">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="5" Name="top" Type="Int32" />
                            <asp:QueryStringParameter DefaultValue="1" Name="os" QueryStringField="os" 
                                Type="Int32" />
                            <asp:Parameter DefaultValue="1" Name="catalogID" Type="Int32" />
                            <asp:Parameter DefaultValue="1" Name="free" Type="Int32" />
                            <asp:Parameter DefaultValue="true" Name="download1" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="download2" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="topRating" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="topNew" Type="Boolean" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                    <asp:HyperLink ID="btnShowTopDownload" class="linkType1" runat="server" Text="Xem tất cả >>" />
                </li>
                <li>
                    <input class="btnLi" type="submit" value="TOP ĐÁNH GIÁ" >
                    <asp:ListView ID="ListView7" runat="server" 
                        DataSourceID="TopDownloadDataSourceRating" EnableModelValidation="True">
                        <EmptyDataTemplate>
                            <span>No data was returned.</span>
                        </EmptyDataTemplate>
                        <ItemTemplate>
                            <li>
                                <asp:Image ID="Image2" runat="server" ImageUrl='<%# Eval("Icon") %>' />
                                <div>
                                    <asp:HyperLink ID="NameLabel0" runat="server" Text='<%# Eval("Name") %>' />
                                    <asp:Label ID="CompanyLabel0" runat="server" Text='<%# Eval("Company") %>' />
                                </div>
                            </li>
                        </ItemTemplate>
                        <LayoutTemplate>
                            <ul ID="itemPlaceholderContainer" runat="server" class="listSoft">
                                <span runat="server" id="itemPlaceholder" />
                            </ul>
                        </LayoutTemplate>
                    </asp:ListView>
                    <asp:HyperLink ID="btnShowTopDownload0" runat="server" class="linkType1" 
                        Text="Xem tất cả &gt;&gt;" />
                    <asp:ObjectDataSource ID="TopDownloadDataSourceRating" runat="server" 
                        SelectMethod="selectTop5" TypeName="UtilObjectData">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="5" Name="top" Type="Int32" />
                            <asp:QueryStringParameter DefaultValue="1" Name="os" QueryStringField="os" 
                                Type="Int32" />
                            <asp:Parameter DefaultValue="1" Name="catalogID" Type="Int32" />
                            <asp:Parameter DefaultValue="-1" Name="free" Type="Int32" />
                            <asp:Parameter DefaultValue="false" Name="download1" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="download2" Type="Boolean" />
                            <asp:Parameter DefaultValue="true" Name="topRating" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="topNew" Type="Boolean" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                    </li>
                <li>
                    <input class="btnLi" type="submit" value="TOP TRONG TUẦN" >
                    <asp:ListView ID="ListView8" runat="server" 
                        DataSourceID="TopDataSourceNew" EnableModelValidation="True">
                        <EmptyDataTemplate>
                            <span>No data was returned.</span>
                        </EmptyDataTemplate>
                        <ItemTemplate>
                            <li>
                                <asp:Image ID="Image3" runat="server" ImageUrl='<%# Eval("Icon") %>' />
                                <div>
                                    <asp:HyperLink ID="NameLabel1" runat="server" Text='<%# Eval("Name") %>' />
                                    <asp:Label ID="CompanyLabel1" runat="server" Text='<%# Eval("Company") %>' />
                                </div>
                            </li>
                        </ItemTemplate>
                        <LayoutTemplate>
                            <ul ID="itemPlaceholderContainer" runat="server" class="listSoft">
                                <span runat="server" id="itemPlaceholder" />
                            </ul>
                        </LayoutTemplate>
                    </asp:ListView>
                    <asp:HyperLink ID="btnShowTopDownload1" runat="server" class="linkType1" 
                        Text="Xem tất cả &gt;&gt;" />
                    <asp:ObjectDataSource ID="TopDataSourceNew" runat="server" 
                        SelectMethod="selectTop5" TypeName="UtilObjectData">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="5" Name="top" Type="Int32" />
                            <asp:QueryStringParameter DefaultValue="1" Name="os" QueryStringField="os" 
                                Type="Int32" />
                            <asp:Parameter DefaultValue="1" Name="catalogID" Type="Int32" />
                            <asp:Parameter DefaultValue="-1" Name="free" Type="Int32" />
                            <asp:Parameter DefaultValue="false" Name="download1" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="download2" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="topRating" Type="Boolean" />
                            <asp:Parameter DefaultValue="true" Name="topNew" Type="Boolean" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                </li>
            </ul>
        </asp:View>
        <asp:View ID="View1" runat="server">           
            <asp:ListView ID="ListView3" runat="server" DataSourceID="ODSCatalogs" 
                EnableModelValidation="True" ondatabinding="ListView3_DataBinding" 
                onitemdatabound="ListView3_ItemDataBound">
                <EmptyDataTemplate>
                    <span>No data was returned.</span>
                </EmptyDataTemplate>                
                <ItemTemplate>      
                    <li>             
                        <asp:Button class="btnLi" ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' CommandName="select"></asp:Button>                    
                        <asp:BulletedList class="childVerUl" ID="childList" OnClick="childCatalog_Click" runat="server" DataSource='<%# Bind("Childs") %>' DataTextField="Name" DataValueField="IdCatalog" DisplayMode="LinkButton">                        
                        </asp:BulletedList>
                    </li>
                </ItemTemplate>
                <LayoutTemplate>
                    <ul ID="itemPlaceholderContainer" runat="server" class="verUl">
                        <li ID="itemPlaceholder" runat="server"></li>
                    </ul>                    
                </LayoutTemplate>
                <SelectedItemTemplate> 
                    <li>
                        <asp:Button ID="NameLabel" runat="server"  Text='<%# Eval("Name") %>' />
                        <asp:BulletedList ID="childList" runat="server" OnClick="childCatalog_Click" DataSource='<%# Bind("Childs") %>' DataTextField="Name" DataValueField="IdCatalog" DisplayMode="LinkButton">                        
                        </asp:BulletedList>
                    </li>
                </SelectedItemTemplate>
            </asp:ListView>
            <asp:ObjectDataSource ID="ODSCatalogs" runat="server" SelectMethod="getCatalog" 
                TypeName="UtilObjectData">
                <SelectParameters>
                    <asp:QueryStringParameter DefaultValue="1" Name="os" QueryStringField="os" 
                        Type="Int32" />
                    <asp:Parameter DefaultValue="1" Name="parentID" Type="Int32" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </asp:View>
    </asp:MultiView>
    </ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="checkTop1" />
        <asp:PostBackTrigger ControlID="checkTop2" />
    </Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="article" Runat="Server">
    <asp:MultiView ID="MultiView2" runat="server" ActiveViewIndex="0">
        <asp:View ID="ViewVNSoft" runat="server">
            <nav>
                <h4 style="position: absolute; text-align: right; height: 30px; font-size: 18px; padding: 5px 3px 0px 0px;color:#ff670f;text-shadow: 1px 1px 3px #030303;filter: dropshadow(color=#030303, offx=1, offy=1); right: 12.5%;">PHẦN MỀM VIỆT </h4>
                <asp:ListView ID="ListView1" runat="server" DataSourceID="vnODS" 
                EnableModelValidation="True">             
                    <EmptyDataTemplate>
                        <table style="">
                            <tr>
                                <td>
                                    No data was returned.</td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <ItemTemplate> 
                        <li>
                            <span>
                                <asp:Button ID="selctVNCatalog" CommandName="select" class="glibtninside" runat="server" Text='<%# Eval("Name") %>' />   
                            </span>
                        </li>                   
                    </ItemTemplate>
                    <LayoutTemplate>  
                        <ul ID="itemPlaceholderContainer" Name="grasp" class="glibtn1" runat="server">
                            <td ID="itemPlaceholder" runat="server">
                            </td>
                        </ul>          
                    </LayoutTemplate>
                    <SelectedItemTemplate>
                        <li class="tagLiSelect">
                            <span>
                                <asp:Button class="glibtninside" ID="selctVNCatalog" runat="server" Text='<%# Eval("Name") %>' />  
                            </span>
                        </li>
                    </SelectedItemTemplate>
                </asp:ListView>
                <asp:ObjectDataSource ID="vnODS" runat="server" SelectMethod="getCatalog" TypeName="UtilObjectData">
                    <SelectParameters>
                        <asp:QueryStringParameter DefaultValue="1" Name="os" QueryStringField="os" Type="Int32" />
                        <asp:Parameter DefaultValue="14" Name="parentID" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                
            </nav>
            <section style="width:100%; background-color:White;">
                <asp:ListView ID="listTopVNNew" runat="server" DataSourceID="ODBTopVNNew" 
                EnableModelValidation="True" GroupItemCount="5">              
                    <EmptyDataTemplate>
                        <table runat="server" style="">
                            <tr>
                                <td>
                                    No data was returned.</td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <emptyitemtemplate>
                        <td runat="server" />
                    </emptyitemtemplate>
                    <grouptemplate>
                        <tr ID="itemPlaceholderContainer" runat="server">
                            <td ID="itemPlaceholder" runat="server">
                            </td>
                        </tr>
                    </grouptemplate>                  
                    <ItemTemplate>
                        <td runat="server" style="text-align:center; width:175px; vertical-align:bottom;">                            
                            <a alt="" style="margin-top: 5px;with:75px;background-position: center center;background-repeat: no-repeat;background-size: contain;display: block;height: 75px; height:75px; dislay:inline; background-image:url('<%# Eval("Icon") %>');"  />
                            <asp:HyperLink style="display:block; font-weight:bold;" class="linkType1" ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                            <asp:Label style="display:block; color:#9C9C9C;" ID="CompanyLabel" runat="server" Text='<%# Eval("Company") %>' />       
                            <div name="star" style="display:block;" star = <%# Eval("Star") %>>
                                <asp:Label style="display:inline-block; color:#9C9C9C;" ID="Rate1Label" runat="server" Text='<%# Eval("Download1") %>' /> 
                            </div>   
                            <a class="btnLi" style="display:inline-block;"><%#Eval("Money") %> </a> <a style="display:inline-block;  background-size: 100% 100%;height: 25px;width: 25px; background-image:url('../Icons/cartcolor.png');" />                  
                        </td>
                    </ItemTemplate>
                    <LayoutTemplate>
                        <table runat="server">
                            <tr runat="server">
                                <td runat="server">
                                    <table ID="groupPlaceholderContainer" runat="server" border="0" style="">
                                        <tr ID="groupPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr runat="server">
                                <td runat="server" style="vertical-align:top; ">dfdsafsd
                                </td>
                            </tr>
                        </table>
                    </LayoutTemplate>
                
                </asp:ListView>
                <asp:ObjectDataSource ID="ODBTopVNNew" runat="server" 
                SelectMethod="selectTop5" TypeName="UtilObjectData">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="50" Name="top" Type="Int32" />
                        <asp:QueryStringParameter DefaultValue="1" Name="os" QueryStringField="os" 
                            Type="Int32" />
                        <asp:Parameter DefaultValue="14" Name="catalogID" Type="Int32" />
                        <asp:Parameter DefaultValue="-1" Name="free" Type="Int32" />
                        <asp:Parameter DefaultValue="false" Name="download1" Type="Boolean" />
                        <asp:Parameter DefaultValue="false" Name="download2" Type="Boolean" />
                        <asp:Parameter DefaultValue="false" Name="topRating" Type="Boolean" />
                        <asp:Parameter DefaultValue="true" Name="topNew" Type="Boolean" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </section>
        </asp:View>
        <asp:View ID="ViewTop" runat="server">
        </asp:View>
    </asp:MultiView>   
</asp:Content>

